package io.adrainty.bolee.insurance.web;

import io.adrainty.bolee.framework.commons.basic.ResultDTO;
import io.adrainty.bolee.framework.commons.utils.ResultDTOUtil;
import io.adrainty.bolee.insurance.models.entity.InsuranceCoefficientEntity;
import io.adrainty.bolee.insurance.service.IInsuranceCoefficientService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>InsuranceCoefficientController</p>
 *
 * @author AdRainty
 * @version V1.0.0
 * @description 保险系数
 * @since 2025/8/15 15:46:37
 */

@Tag(name = "保险系数")
@RestController
@RequestMapping("/insurance-coefficent")
public class InsuranceCoefficientController {

    @Resource
    private IInsuranceCoefficientService insuranceCoefficientService;

    @PutMapping
    @Operation(summary = "创建保险系数")
    public ResultDTO<Boolean> createInsuranceCoefficients(@RequestBody List<InsuranceCoefficientEntity> insuranceCoefficientVOs) {
        Boolean result = insuranceCoefficientService.createInsuranceCoefficients(insuranceCoefficientVOs);
        return ResultDTOUtil.success(result);
    }

    @PatchMapping
    @Operation(summary = "更新保险系数")
    public ResultDTO<Boolean> updateInsuranceCoefficent(@RequestBody List<InsuranceCoefficientEntity> insuranceCoefficientVOs) {
        Boolean result = insuranceCoefficientService.updateInsuranceCoefficent(insuranceCoefficientVOs);
        return ResultDTOUtil.success(result);
    }

}
